import os
from datetime import datetime
from django.db import models
from api.utils.models import AbstractBase


class Payment(models.Model):
    appid = models.CharField("应用ID", max_length=256, default="")
    app_debug = models.BooleanField("是否测试环境", default=True)
    alipay_url = models.CharField("支付宝网关", max_length=256, default="")
    alipay_return_url = models.CharField("支付成功回调地址", max_length=256, default="")
    app_key = models.TextField("应用公钥", max_length=1024, default="")
    ali_key = models.TextField("支付宝公钥", max_length=1024, default="")


class Payrecord(models.Model):
    order = models.ForeignKey("Order", on_delete=models.CASCADE, related_name="pay")
    trade_num = models.IntegerField("支付宝流水号", default=0)
